{% extends "admin/base_site.html" %}
{% load i18n %}
{% block javascripts %}
    {{ block.super }}
    <script type="text/javascript" charset="utf-8">
        (function($) {
            $(document).ready(function(){
                var anchors = $("#grp-docutils-content").find("h2");
                $(anchors).each(function() {
                    var anchorId = $(this).attr("id");
                    $(this).removeAttr("id");
                    $("<span id=" + anchorId + " class='grp-anchor' />").insertBefore(this);
                });
            });
        })(grp.jQuery);
    </script>
{% endblock %}

{% block bodyclass %}grp-docutils grp-model-index{% endblock %}
{% block content-class %}{% endblock %}
{% block breadcrumbs %}
    <ul>
        <li><a href="../../">{% trans "Home" %}</a></li>
        <li><a href="../">Documentation</a></li>
        <li>Models</li>
    </ul>
{% endblock %}
{% block title %}Models{% endblock %}

{% block content %}
    <h1>Model documentation</h1>
    {% regroup models by app_label as grouped_models %}
    <div class="g-d-c">
        <div class="g-d-6">
            <div class="grp-module">
                <h2>Model groups</h2>
                <ul class="grp-listing-small">
                    {% regroup models by app_label as grouped_models %}
                    {% for group in grouped_models %}
                        <li class="grp-row"><a href="#app-{{ group.grouper }}"><strong>{{ group.grouper|capfirst }}</strong></a></li>
                    {% endfor %}
                </ul>
            </div>
        </div>
        <div class="g-d-18 g-d-l grp-rte" id="grp-docutils-content">
            {% for group in grouped_models %}
                <div class="grp-module">
                    <h2 id="app-{{ group.grouper }}">{{ group.grouper|capfirst }}</h2>
                    <table class="grp-table grp-full">
                        {% for model in group.list %}
                            <tr>
                                <th><a href="{{ model.app_label }}.{{ model.object_name.lower }}/">{{ model.object_name }}</a></th>
                            </tr>
                        {% endfor %}
                    </table>
                </div>
            {% endfor %}
        </div>
    </div>
{% endblock %}
